package com.jc.cloud.sign.controller.tencent;

import com.jc.cloud.sign.common.LoginVo;
import com.jc.cloud.sign.common.R;
import com.jc.cloud.sign.service.OrganizationInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  登录接口
 * </p>
 *
 * @author cxc
 * @since 2023-11-14
 */
@Api(tags = "登录接口")
@RestController
@RequestMapping("/organization-info")
public class OrganizationInfoController {

    @Autowired
    private OrganizationInfoService organizationInfoService;

    /**
     * @Author HongQiYi
     * @Description 锦辰云登录
     **/
    @ApiOperation("登录")
    @PostMapping("login")
    public R login(@RequestBody LoginVo loginVo) throws Exception {
        String token = organizationInfoService.login(loginVo);
        return R.ok().put("token",token).put("msg","登录成功");
    }

    /**
     * @Author HongQiYi
     * @Description 腾讯发送短信
     **/
    @ApiOperation("腾讯发送短信的方法")
    @GetMapping("/send/{phone}")
    public R SendSms(@PathVariable String phone){
        String msg = organizationInfoService.sendmsg(phone);
        return R.ok().put("msg",msg);
    }

}

